{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from string import ascii_lowercase\n",
    "\n",
    "letters_data = pd.Series(list(ascii_lowercase))\n",
    "print(letters_data.index, letters_data.values, sep='\\n')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "7278717\n",
      "Index(['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado',\n",
      "       'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Idaho',\n",
      "       'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana',\n",
      "       'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota',\n",
      "       'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada',\n",
      "       'New Hampshire', 'New Jersey', 'New Mexico', 'New York',\n",
      "       'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Oregon',\n",
      "       'Pennsylvania', 'Rhode Island', 'South Carolina', 'South Dakota',\n",
      "       'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington',\n",
      "       'West Virginia', 'Wisconsin', 'Wyoming'],\n",
      "      dtype='object')\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "states = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming']\n",
    "populations = [4903185, 731545, 7278717, 3017825, 39538223, 578713, 3605944, 986809, 21538187, 10711908, 1455271, 1826156, 12671821, 6745354, 3179849, 2913314, 4467673, 4648794, 1344212, 6045680, 6893574, 9986857, 5639632, 2976149, 6137428, 1068778, 1934408, 3080156, 3139658, 1363582, 10100233, 10439388, 762062, 19849399, 10488084, 762062, 11689100, 3953823, 4217737, 12801989, 1059361, 5148714, 884659, 6897576, 328239523, 3205958, 623347, 8535519, 7614893, 1792147]\n",
    "\n",
    "state_popul = pd.Series(data=populations, index=states)\n",
    "state = input()\n",
    "print(state_popul[state], state_popul.index, sep='\\n')\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Alaska           731545\n",
      "California     39538223\n",
      "Connecticut     3605944\n",
      "dtype: int64\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "states = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming']\n",
    "populations = [4903185, 731545, 7278717, 3017825, 39538223, 578713, 3605944, 986809, 21538187, 10711908, 1455271, 1826156, 12671821, 6745354, 3179849, 2913314, 4467673, 4648794, 1344212, 6045680, 6893574, 9986857, 5639632, 2976149, 6137428, 1068778, 1934408, 3080156, 3139658, 1363582, 10100233, 10439388, 762062, 19849399, 10488084, 762062, 11689100, 3953823, 4217737, 12801989, 1059361, 5148714, 884659, 6897576, 328239523, 3205958, 623347, 8535519, 7614893, 1792147]\n",
    "state_popul = pd.Series(data=populations, index=states)\n",
    "states_input = input().split()\n",
    "\n",
    "print(state_popul[states_input])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2022-05-02    73\n",
      "dtype: object\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "dates = input().split()\n",
    "prices = [int(x) for x in input().split()]\n",
    "date_value = input().split()\n",
    "\n",
    "date_price = pd.Series(data=prices, index=dates)\n",
    "\n",
    "print(date_price[date_value])\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[64 73 71]\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "dates = input().split()\n",
    "prices = input().split()\n",
    "dates_for_price = input().split()\n",
    "series = pd.Series(data=prices, index=dates, dtype=int)\n",
    "s2 = pd.Series(data=series[dates_for_price], index=dates_for_price)\n",
    "print(*s2.values)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2019-11-01     7\n",
      "2019-11-02    26\n",
      "2019-11-03    13\n",
      "dtype: int64\n"
     ]
    }
   ],
   "source": [
    "from datetime import datetime\n",
    "import pandas as pd\n",
    "pattern = '%Y-%m-%d'\n",
    "dates = ['2019-11-01', '2019-11-02', '2019-11-03']\n",
    "temperatures = [7, 26, 13]\n",
    "dates_dt = [datetime.strptime(date, pattern).date() for date in dates]\n",
    "month = int(input())\n",
    "ser = pd.Series(data=temperatures, index=dates_dt)\n",
    "\n",
    "print(ser[[x for x in ser.index if x.month == 11]])\n",
    "# for date, temperature in zip(ser.index, ser.values):\n",
    "#     if date.month == month:\n",
    "#         print(date, temperature)\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "\n",
    "names = input().split()\n",
    "scores = input().split()\n",
    "names_for_score = input().split()\n",
    "series = pd.Series(data=scores, index=names)\n",
    "print(*series[names_for_score].values)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "dddd 25\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "countries = input().split()\n",
    "population = input().split()\n",
    "\n",
    "country, new_population = input().split()\n",
    "\n",
    "series = pd.Series(data=population, index=country, dtype=float)\n",
    "\n",
    "series[country] = new_population\n",
    "print(series)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "\n",
    "series = pd.Series(data=prices, index=books)\n",
    "\n",
    "print(series)\n",
    "\n",
    "book = input()\n",
    "new_price = input()\n",
    "\n",
    "series[book] = new_price\n",
    "\n",
    "print(series)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2022-06-04    68\n",
      "2022-06-05    72\n",
      "2022-06-06    75\n",
      "2022-06-07    70\n",
      "2022-06-08    68\n",
      "2022-06-09    73\n",
      "2022-06-10    79\n",
      "dtype: int64\n",
      "\n",
      "2022-06-04    20.000000\n",
      "2022-06-05    22.222222\n",
      "2022-06-06    23.888889\n",
      "2022-06-07    21.111111\n",
      "2022-06-08    20.000000\n",
      "2022-06-09    22.777778\n",
      "2022-06-10    26.111111\n",
      "dtype: float64\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "dates = ['2022-06-04', '2022-06-05', '2022-06-06', '2022-06-07', '2022-06-08', '2022-06-09', '2022-06-10']\n",
    "temperatures = [68, 72, 75, 70, 68, 73, 79]\n",
    "\n",
    "series = pd.Series(data=temperatures, index=dates)\n",
    "\n",
    "print(series)\n",
    "print()\n",
    "\n",
    "series = (series - 32) * (5 / 9)\n",
    "\n",
    "\n",
    "print(series)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
